/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.webhomesites.padrao.utils;

import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;

/**
 *
 * @author Webhome
 */
public class DigitosPermitidos extends PlainDocument {
    
    @Override
    public void insertString(int offset, String str, javax.swing.text.AttributeSet attr)
    throws BadLocationException {
        super.insertString(offset, str.toUpperCase().replaceAll("[^a-z|^A-Z]^",""), attr);
    }
    
    public void replace(int offset, String str, javax.swing.text.AttributeSet attr)
    throws BadLocationException {
        super.insertString(offset, str.toUpperCase().replaceAll("[^a-z|^A-Z]^",""), attr);
    }
    
}
